MODULE YOMGDI1S
! (C) Copyright 2005- ECMWF.
!
! This software is licensed under the terms of the Apache Licence Version 2.0
! which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
! In applying this licence, ECMWF does not waive the privileges and immunities
! granted to it by virtue of its status as an intergovernmental organisation
! nor does it submit to any jurisdiction.

USE PARKIND1  ,ONLY : JPIM     ,JPRB

IMPLICIT NONE
SAVE

!*    diagnostics specific to the surface one-column model


! GDI1S   : generic for diagnostics specific to the surface
!            one-column model (last index 1 for instantaneous,
!               2 for accumulated)

!     THE DIAGNOSTICS ARE MEANT TO BE VERY COMPLETE AND REPRESENT
!     EVERY INDIVIDUAL TERM IN THE SURFACE PROGNOSTIC VARIABLES
!     EQUATIONS



!        A) TILE BALANCE (for each tile)

!         0 = D1STISRD + D1STISRU + D1STITRD + D1STITRU + D1STIH +
!                D1STILE - D1STIGFL + D1STII
!     Additional diagnostics:  D1STIEVAP, D1STIFR*, D1STITK*, D1STIALB*

!     where:

!     D1STISRD  - SW RAD DOWN
!     D1STISRU  - SW RAD UP
!     D1STITRD  - LW RAD DOWN
!     D1STITRU  - SW RAD UP
!     D1STIH - SENSIBLE HEAT FLUX
!     D1STILE - LATENT   HEAT FLUX
!     D1STILES - LATENT   HEAT FLUX SNOW UNDER VEGETATION
!     D1STIGFL  - SK/S GROUND HEAT FLUX
!     D1STII    - NUMERICS IMPLICIT
!     D1STIEVAP - Tile evaporation
!     D1STIFR*   - Tile fraction
!     D1STITK*   - Tile skin T
!     D1STIALB*  - Tile albedo


!        B) THERMAL BALANCE


!        B.1) SKIN LAYER (TSK)

!            0 = D1STKSRD + D1STKSRU + D1STKTRD + D1STKTRU + D1AHFS +
!                D1AHFL   - D1STKGFL

!     WHERE ALL TERMS ARE THE WEIGHTED SUM OVER TILES


!        B.2) SNOW LAYER (TSN)

!     TENDENCY = D1STNSRD + D1STNSRU + D1STNTRD + D1STNTRU +
!                D1STIFR(5)*D1STIH(5)   + D1STIFR(7)*D1STIH(7)   +
!                D1STIFR(5)*D1STILE(5)  + D1STIFR(7)*D1STILE(7)  +
!                D1STNGFL + D1STNM
!     Additional diagnostics: D1SNDEPTH*,D1SNFR*,D1SNTFR*,D1SNAFR*

!     WHERE:

!     D1STNSRD  - SW RAD DOWN
!     D1STNSRU  - SW RAD UP
!     D1STNTRD  - LW RAD DOWN
!     D1STNTRU  - SW RAD UP
!     D1STNGFL  - Snow basal heat flux
!     D1STNM    - Snow melting
!     D1SNDEPTH* - Snow depth
!     D1SNFR*    - snow fraction
!     D1SNTFR*   - fraction weighted snow temperature
!     D1SNAFR*   - fraction weighted snow albedo


!        B.3) 1ST SOIL LAYER (TSA(1))

!     TENDENCY = D1ST1SRD + D1ST1SRU + D1ST1TRD + D1ST1TRU + D1ST1H +
!                D1ST1LE  - D1STAGFL(1) + D1STNGFL + D1STASF(1)

!     WHERE:

!     D1ST1SRD  - SW RAD DOWN
!     D1ST1SRU  - SW RAD UP
!     D1ST1TRD  - LW RAD DOWN
!     D1ST1TRU  - SW RAD UP
!     D1ST1H    - SENSIBLE HEAT FLUX
!     D1ST1LE   - LATENT   HEAT FLUX
!     D1STAGFL(1) - N/N+1 GROUND HEAT FLUX
!     D1STASF(1)  - SOIL WATER PHASE CHANGES


!        B.4) 2ND SOIL LAYER (TSA(2))

!     TENDENCY =   D1STAGFL(1) - D1STAGFL(2) + D1STASF(2)

!     WHERE:

!     D1STAGFL(1) - N-1/N GROUND FLUX
!     D1STAGFL(2) - N/N+1 GROUND FLUX
!     D1STASF(2)  - SOIL WATER PHASE CHANGES


!        B.5) 3RD SOIL LAYER (TSA(3))

!     TENDENCY =   D1STAGFL(2) - D1STAGFL(3) + D1STASF(3)

!     WHERE:

!     D1STAGFL(2) - N-1/N GROUND FLUX
!     D1STAGFL(3) - N/N+1 GROUND FLUX
!     D1STASF(3)  - SOIL WATER PHASE CHANGES


!        B.6) 4TH SOIL LAYER (TSA(4))

!     TENDENCY =   D1STAGFL(3) + D1STASF(4)

!     WHERE:

!     D1STAGFL(3) - N-1/N GROUND FLUX
!     D1STASF(4)  - SOIL WATER PHASE CHANGES


!        C) WATER BALANCE


!        C.1) SNOW LAYER (SN)

!     TENDENCY = D1SSFL + D1SSFC + D1SWNJQ + D1SWNM

!     WHERE:

!     D1SSFL   - LARGE-SCALE SNOWFALL
!     D1SSFC   - CONVECTIVE SNOWFALL
!     D1SWNJQ  - EVAPORATION
!     D1SWNM   - MELTING


!        C.2) SKIN RESERVOIR (SWL)

!     TENDENCY = D1SWLIT + D1SWLJQ
!     Additional diagnostics: D1SWFR*

!     WHERE:

!     D1SWLIT  - INTERCEPTION
!     D1SWLJQ  - SKIN RESERVOIR EVAPORATION
!                 INCLUDES:
!                    - INITIAL CLIPPING OF PWL 0 < PWL < PWLMAX
!                    - UPWARDS EVAPORATION (INCLUDING IMPLICIT EFFECT)
!                    - COLLECTION OF DEW
!     D1SWFR*    - interception fraction



!        C.3) 1ST SOIL LAYER (SWA(1))

!     TENDENCY = D1SW1JBG  + D1SW1TF    - D1SWAGFL(1) + D1SW1RI +
!                D1SWARS(1) + D1SWAEXT(1) + D1SW1M    + D1SW1C  + D1SWAC(1)
!     Additional diagnostics: D1SWAFR(1)*

!     WHERE:

!     D1SW1JBG    - BARE GROUND EVAPORATION
!     D1SW1TF     - THROUGHFALL
!     D1SWAGFL(1) - N/N+1 WATER FLUX
!     D1SW1RI     - INFILTRATION LIMIT RUNOFF 
!                    (includes snow melting runoff)
!     D1SWARS(1)  - SATURATION EXCESS RUNOFF
!     D1SWAEXT(1) - ROOT EXTRACTION
!     D1SW1M      - MELTING
!     D1SW1C      - EXCESS CONDENSATION (removed from root extraction)
!     D1SWAC(1)   - CLIPPING (NON-NEGATIVE VALUES)
!     D1SWAFR*    - LIQUID WATER


!        C.4) 2ND SOIL LAYER (SWA(2))

!     TENDENCY =   D1SWAGFL(1) - D1SWAGFL(2) + D1SWARS(2) + D1SWAEXT(2) +
!                  D1SWAC(2)
!     Additional diagnostics: D1SWAFR(1)*

!     WHERE:

!     D1SWAGFL(1) - N-1/N WATER FLUX
!     D1SWAGFL(2) - N/N+1 WATER FLUX
!     D1SWARS(2)  - SATURATION EXCESS RUNOFF
!     D1SWAEXT(2) - ROOT EXTRACTION
!     D1SWAC(2)   - CLIPPING (NON-NEGATIVE VALUES)
!     D1SWAFR*    - LIQUID WATER


!        C.5) 3RD SOIL LAYER (SWA(3))

!     TENDENCY =   D1SWAGFL(2) - D1SWAGFL(3) + D1SWARS(3) + D1SWAEXT(3) +
!                  D1SWAC(3)
!     D1SWAFR*    - LIQUID WATER

!     WHERE:

!     D1SWAGFL(2) - N-1/N WATER FLUX
!     D1SWAGFL(3) - N/N+1 WATER FLUX
!     D1SWARS(3)  - SATURATION EXCESS RUNOFF
!     D1SWAEXT(3) - ROOT EXTRACTION
!     D1SWAC(3)   - CLIPPING (NON-NEGATIVE VALUES)
!     D1SWAFR*    - LIQUID WATER


!        C.6) 4TH SOIL LAYER (SWA(4))

!     TENDENCY =   D1SWAGFL(3) - D1SWAGFL(4) + D1SWARS(4) + D1SWAEXT(4) +
!                  D1SWAC(4)
!     D1SWAFR*    - LIQUID WATER

!     WHERE:

!     D1SWAGFL(3) - N-1/N WATER FLUX
!     D1SWAGFL(4) - N/N+1 WATER FLUX
!     D1SWARS(4)  - SATURATION EXCESS RUNOFF
!     D1SWAEXT(4) - ROOT EXTRACTION
!     D1SWAC(4)   - CLIPPING (NON-NEGATIVE VALUES)
!     D1SWAFR*    - LIQUID WATER

!        D) MOMENTUM BUDGET

!     D1MOMU      - TURBULENT MOMENTUM FLUX U
!     D1MOMV      - TURBULENT MOMENTUM FLUX V


!        E) CO2 BUDGET 

! An = Ag + Rd  (kgCO2 m-2 s-1)
! fluxes positive upwards: Ag negative, Rd positive

! CO2 flux = An + Rsoil (kgCO2 m-2 s-1)
! fluxes positive upwards :
! An negative if absolute value of Ag exceeds absolute value of Rd
! Rsoil negative

! Values per vegetation type:
!     D1SVTAN = D1SVTAG + D1SVTRD
!     D1SVTCO2FLUX = D1SVTAN + D1SVTRSOIL
! Grid values:
!     D1SAN = D1SAG + D1SRD
!     D1SCO2FLUX = D1SAN + D1SRSOIL


!     * denotes values that are non-accumulated



!     NOTE: UNITS OF THERMAL FLUXES - W/M**2
!                    WATER   FLUXES - (KG/M**2)/S
!                    MOMENTUM FLUXES - (KG/M)/S**2

!           SIGN CONVENTION - ALL FLUXES ARE POSITIVE DOWNWARD

!           GRID STAGGERING/INDEXING - VARIABLES AT CENTER OF GRID
!                        EXCEPT FOR THE WATER AND THERMAL SOIL FLUXES
!                        WHERE THE N VALUE IS AT THE N/N+1 INTERFACE

!           NAME CONVENTIONS

!                  ATMOSPHERIC FORCINGS HAVE NO NAME CONVENTIONS
!                  THE FIRST THREE CHARACTERS IDENTIFY THE VARIABLE

!                  D1STKXXX     SKIN TEMPERATURE FLUX
!                  D1STAXXX     SOIL TEMPERATURE FLUX (ARRAY)
!                  D1STnXXX     SOIL TEMPERATURE FLUX FOR LAYER n
!                  D1SWNXXX     SNOW FLUX
!                  D1SWLXXX     INTERCEPTION RESERVOIR FLUX
!                  D1SWAXXX     SOIL WATER FLUX (ARRAY)
!                  D1SWnXXX     SOIL WATER FLUX FOR LAYER n


! gdiaux1s:

!     D1SAVTK:		SKIN TEMPERATURE AVERAGED OVER GRIDBOX
!     D1SRADTK:		RADIATIVE SKIN TEMPERATURE AVERAGED OVER GRIDBOX
!     D1SVEGTK:		AVERAGE VEGETATION TEMPERATURE
!     D1SGHF:		TOTAL HEAT FLUX INTO GROUND (SK*DT +
!			TRANSMISSION + SNOW HEAT FLUX)
!     D1SALB:		AVERAGE ALBEDO
!     D1SVEGEV:         VEGETATION TRANSPIRATION
!     D1SDSH:           SOIL HEAT CHANGE
!     D1STNDH:		SNOW HEAT CHANGE
!     D1SWDS:		CHANGE in SOIL WATER STORAGE
!     D1SSDSSL:		CHANGE in SOIL WATER STORAGE per layer
!     D1SSDS:		CHANGE IN SNOW WATER STORAGE
!     D1SWLDS:		CHANGE IN INTERCEPTION STORAGE
!     D1SLSRF:		LARGE SCALE RAINFALL
!     D1SCRF:		CONVECTIVE RAINFALL
!     D1SLSSF:		LARGE SCALE SNOWFALL
!     D1SCSF:		CONVECTIVE SNOWFALL
!     D1STE:		TOTAL EVAPORATION
!     D1STRO:		TOTAL RUNOFF
!     D1STSRO:		TOTAL SURFACE RUNOFF
!     D1SMLT:		SNOW MELT
!     D1SVTRC:      CANOPY RESISTANCE FOR LOW AND HIGH VEGETATION  
!     D1SVTRA:      AERODYNAMIC RESISTANCE FOR LOW AND HIGH VEGEATION 
!     D1T2M:        SCREENLEVEL AIR TEMPERATURE
!     D1D2M:        SCREENLEVEL AIR DEW POINT TEMPERATURE

!     D1SLAI:	        GRID AVERAGED LAI 
!     D1SBIOM:          GRID AVERAGED BIOMASS
!     D1SBLOSS:		GRID AVERAGED BIOMASS LOSS
!     D1SBGAIN:		GRID AVERAGED BIOMASS GAIN
!     D1SBIOMSTR:	GRID AVERAGED ABOVE GROUND STRUCTURAL BIOMASS
!     D1SBIOMSTRB:	GRID AVERAGED BELOW GROUND STRUCTURAL BIOMASS
!     D1SVTFR:          VEGETATION TYPE FRACTION WITHIN GRID BOX (=/ TILE FR)
!     D1SVTLAI:         LAI PER VEGETATION TYPE       
!     D1SVTBIOM:        BIOMASS PER VEGETATION TYPE
!     D1SVTBLOSS:       BIOMASS LOSS PER VEGETATION TYPE
!     D1SVTBGAIN:       BIOMASS GAIN PER VEGETATION TYPE
!     D1SVTBIOMSTR:     ABOVE GROUND STRUCTURAL BIOMASS PER VEGETATION TYPE
!     D1SVTBIOMSTRB:    BELOW GROUND STRUCTURAL BIOMASS PER VEGETATION TYPE
!     D1SVTGC:          CANOPY CONDUCTANCE PER VEGETATION TYPE  
!     D1SVTGA:          AERODYNAMIC CONDUCTANCE PER VEGETATION TYPE 
!     D1SVTF2:          SOIL MOISTURE STRESS FUNTION PER VT.
!     D1SVTDS:          SPECIFIC HUMIDITY DEFICIT (AT CANOPY LEVEL) PER VT
!     D1SVTDMAX:        MAX SPECIFIC HUMIDITY DEFICIT PER VT
!     D1SVTLE           LATENT HEAT FLUX PER VEGETATION TYPE



REAL(KIND=JPRB),ALLOCATABLE,TARGET:: GDI1S(:,:,:)
REAL(KIND=JPRB),ALLOCATABLE,TARGET:: GDIAUX1S(:,:,:)

REAL(KIND=JPRB),POINTER:: D1STISRD(:,:)
REAL(KIND=JPRB),POINTER:: D1STISRU(:,:)
REAL(KIND=JPRB),POINTER:: D1STITRD(:,:)
REAL(KIND=JPRB),POINTER:: D1STITRU(:,:)
REAL(KIND=JPRB),POINTER:: D1STIH(:,:)
REAL(KIND=JPRB),POINTER:: D1STILE(:,:)
REAL(KIND=JPRB),POINTER:: D1STILES(:,:)
REAL(KIND=JPRB),POINTER:: D1STIGFL(:,:)
REAL(KIND=JPRB),POINTER:: D1STII(:,:)
REAL(KIND=JPRB),POINTER:: D1STIEVAP(:,:)
REAL(KIND=JPRB),POINTER:: D1STIEVAPU(:,:)
REAL(KIND=JPRB),POINTER:: D1SRFLD(:)
REAL(KIND=JPRB),POINTER:: D1SRFLU(:)
REAL(KIND=JPRB),POINTER:: D1TRFLD(:)
REAL(KIND=JPRB),POINTER:: D1TRFLU(:)
REAL(KIND=JPRB),POINTER:: D1STNSRD(:)
REAL(KIND=JPRB),POINTER:: D1STNSRU(:)
REAL(KIND=JPRB),POINTER:: D1STNTRD(:)
REAL(KIND=JPRB),POINTER:: D1STNTRU(:)
REAL(KIND=JPRB),POINTER:: D1STNGFL(:)
REAL(KIND=JPRB),POINTER:: D1STNM(:)
REAL(KIND=JPRB),POINTER:: D1ST1SRD(:)
REAL(KIND=JPRB),POINTER:: D1ST1SRU(:)
REAL(KIND=JPRB),POINTER:: D1ST1TRD(:)
REAL(KIND=JPRB),POINTER:: D1ST1TRU(:)
REAL(KIND=JPRB),POINTER:: D1AHFS(:)
REAL(KIND=JPRB),POINTER:: D1AHFL(:)
REAL(KIND=JPRB),POINTER:: D1MOMU(:)
REAL(KIND=JPRB),POINTER:: D1MOMV(:)
REAL(KIND=JPRB),POINTER:: D1ST1H(:)
REAL(KIND=JPRB),POINTER:: D1ST1LE(:)
REAL(KIND=JPRB),POINTER:: D1STAGFL(:,:)
REAL(KIND=JPRB),POINTER:: D1STASF(:,:)
REAL(KIND=JPRB),POINTER:: D1SSFL(:)
REAL(KIND=JPRB),POINTER:: D1SSFC(:)
REAL(KIND=JPRB),POINTER:: D1SWNJQ(:)
REAL(KIND=JPRB),POINTER:: D1SWNM(:)
REAL(KIND=JPRB),POINTER:: D1SWLIT(:)
REAL(KIND=JPRB),POINTER:: D1SWLJQ(:)
REAL(KIND=JPRB),POINTER:: D1SW1JBG(:)
REAL(KIND=JPRB),POINTER:: D1SW1TF(:)
REAL(KIND=JPRB),POINTER:: D1SWAGFL(:,:)
REAL(KIND=JPRB),POINTER:: D1SW1RI(:)
REAL(KIND=JPRB),POINTER:: D1SWARS(:,:)
REAL(KIND=JPRB),POINTER:: D1SWAEXT(:,:)
REAL(KIND=JPRB),POINTER:: D1SW1M(:)
REAL(KIND=JPRB),POINTER:: D1SW1C(:)
REAL(KIND=JPRB),POINTER:: D1SWAC(:,:)

! CO2 per vegetation type
REAL(KIND=JPRB),POINTER:: D1SVTAN(:,:)
REAL(KIND=JPRB),POINTER:: D1SVTAG(:,:)
REAL(KIND=JPRB),POINTER:: D1SVTRD(:,:)
REAL(KIND=JPRB),POINTER:: D1SVTRSOIL(:,:)
REAL(KIND=JPRB),POINTER:: D1SVTCO2FLUX(:,:)
REAL(KIND=JPRB),POINTER:: D1SVTRNOQ10(:,:)
! CO2 GRID
REAL(KIND=JPRB),POINTER:: D1SAN(:)
REAL(KIND=JPRB),POINTER:: D1SAG(:)
REAL(KIND=JPRB),POINTER:: D1SRD(:)
REAL(KIND=JPRB),POINTER:: D1SRSOIL(:)
REAL(KIND=JPRB),POINTER:: D1SCO2FLUX(:)
REAL(KIND=JPRB),POINTER:: D1SCH4FLUX(:)
REAL(KIND=JPRB),POINTER:: D1SBVOCFLUX(:)


REAL(KIND=JPRB),POINTER:: D1STISRD2(:,:,:)
REAL(KIND=JPRB),POINTER:: D1STISRU2(:,:,:)
REAL(KIND=JPRB),POINTER:: D1STITRD2(:,:,:)
REAL(KIND=JPRB),POINTER:: D1STITRU2(:,:,:)
REAL(KIND=JPRB),POINTER:: D1STIH2(:,:,:)
REAL(KIND=JPRB),POINTER:: D1STILE2(:,:,:)
REAL(KIND=JPRB),POINTER:: D1STILES2(:,:,:)
REAL(KIND=JPRB),POINTER:: D1STIGFL2(:,:,:)
REAL(KIND=JPRB),POINTER:: D1STII2(:,:,:)
REAL(KIND=JPRB),POINTER:: D1STIEVAP2(:,:,:)
REAL(KIND=JPRB),POINTER:: D1STIEVAPU2(:,:,:)
REAL(KIND=JPRB),POINTER:: D1SRFLD2(:,:)
REAL(KIND=JPRB),POINTER:: D1SRFLU2(:,:)
REAL(KIND=JPRB),POINTER:: D1TRFLD2(:,:)
REAL(KIND=JPRB),POINTER:: D1TRFLU2(:,:)
REAL(KIND=JPRB),POINTER:: D1STNSRD2(:,:)
REAL(KIND=JPRB),POINTER:: D1STNSRU2(:,:)
REAL(KIND=JPRB),POINTER:: D1STNTRD2(:,:)
REAL(KIND=JPRB),POINTER:: D1STNTRU2(:,:)
REAL(KIND=JPRB),POINTER:: D1STNGFL2(:,:)
REAL(KIND=JPRB),POINTER:: D1STNM2(:,:)
REAL(KIND=JPRB),POINTER:: D1ST1SRD2(:,:)
REAL(KIND=JPRB),POINTER:: D1ST1SRU2(:,:)
REAL(KIND=JPRB),POINTER:: D1ST1TRD2(:,:)
REAL(KIND=JPRB),POINTER:: D1ST1TRU2(:,:)
REAL(KIND=JPRB),POINTER:: D1AHFS2(:,:)
REAL(KIND=JPRB),POINTER:: D1AHFL2(:,:)
REAL(KIND=JPRB),POINTER:: D1ST1H2(:,:)
REAL(KIND=JPRB),POINTER:: D1ST1LE2(:,:)
REAL(KIND=JPRB),POINTER:: D1STAGFL2(:,:,:)
REAL(KIND=JPRB),POINTER:: D1STASF2(:,:,:)
REAL(KIND=JPRB),POINTER:: D1SSFL2(:,:)
REAL(KIND=JPRB),POINTER:: D1SSFC2(:,:)
REAL(KIND=JPRB),POINTER:: D1SWNJQ2(:,:)
REAL(KIND=JPRB),POINTER:: D1SWNM2(:,:)
REAL(KIND=JPRB),POINTER:: D1SWLIT2(:,:)
REAL(KIND=JPRB),POINTER:: D1SWLJQ2(:,:)
REAL(KIND=JPRB),POINTER:: D1SW1JBG2(:,:)
REAL(KIND=JPRB),POINTER:: D1SW1TF2(:,:)
REAL(KIND=JPRB),POINTER:: D1SWAGFL2(:,:,:)
REAL(KIND=JPRB),POINTER:: D1SW1RI2(:,:)
REAL(KIND=JPRB),POINTER:: D1SWARS2(:,:,:)
REAL(KIND=JPRB),POINTER:: D1SWAEXT2(:,:,:)
REAL(KIND=JPRB),POINTER:: D1SW1M2(:,:)
REAL(KIND=JPRB),POINTER:: D1SW1C2(:,:)
REAL(KIND=JPRB),POINTER:: D1SWAC2(:,:,:)

! CO2 per vegetation type
REAL(KIND=JPRB),POINTER:: D1SVTAN2(:,:,:)
REAL(KIND=JPRB),POINTER:: D1SVTAG2(:,:,:)
REAL(KIND=JPRB),POINTER:: D1SVTRD2(:,:,:)
REAL(KIND=JPRB),POINTER:: D1SVTRSOIL2(:,:,:)
REAL(KIND=JPRB),POINTER:: D1SVTRNOQ102(:,:,:)
REAL(KIND=JPRB),POINTER:: D1SVTCO2FLUX2(:,:,:)
! CO2 GRID
REAL(KIND=JPRB),POINTER:: D1SAN2(:,:)
REAL(KIND=JPRB),POINTER:: D1SAG2(:,:)
REAL(KIND=JPRB),POINTER:: D1SRD2(:,:)
REAL(KIND=JPRB),POINTER:: D1SRSOIL2(:,:)
REAL(KIND=JPRB),POINTER:: D1SCO2FLUX2(:,:)
REAL(KIND=JPRB),POINTER:: D1SCH4FLUX2(:,:)
REAL(KIND=JPRB),POINTER:: D1SBVOCFLUX2(:,:)

REAL(KIND=JPRB),POINTER:: D1STIFR(:,:)
REAL(KIND=JPRB),POINTER:: D1STITK(:,:)
REAL(KIND=JPRB),POINTER:: D1STIALB(:,:)
REAL(KIND=JPRB),POINTER:: D1SNDEPTH(:)
REAL(KIND=JPRB),POINTER:: D1SNFR(:)
REAL(KIND=JPRB),POINTER:: D1SNTFR(:)
REAL(KIND=JPRB),POINTER:: D1SNAFR(:)

REAL(KIND=JPRB),POINTER:: D1SWFR(:)

REAL(KIND=JPRB),POINTER:: D1SWAFR(:,:)
REAL(KIND=JPRB),POINTER:: D1SAVTK(:)
REAL(KIND=JPRB),POINTER:: D1SRADTK(:)
REAL(KIND=JPRB),POINTER:: D1SVEGTK(:)
REAL(KIND=JPRB),POINTER:: D1SALB(:)
REAL(KIND=JPRB),POINTER:: D1SGHF(:)
REAL(KIND=JPRB),POINTER:: D1SVEGEV(:)
REAL(KIND=JPRB),POINTER:: D1SDSH(:)
REAL(KIND=JPRB),POINTER:: D1STNDH(:)
REAL(KIND=JPRB),POINTER:: D1SWDS(:)
REAL(KIND=JPRB),POINTER:: D1SSDS(:)
REAL(KIND=JPRB),POINTER:: D1SSDSSL(:,:)
REAL(KIND=JPRB),POINTER:: D1SWLDS(:)
REAL(KIND=JPRB),POINTER:: D1SLSRF(:)
REAL(KIND=JPRB),POINTER:: D1SCRF(:)
REAL(KIND=JPRB),POINTER:: D1SLSSF(:)
REAL(KIND=JPRB),POINTER:: D1SCSF(:)
REAL(KIND=JPRB),POINTER:: D1STE(:)
REAL(KIND=JPRB),POINTER:: D1STRO(:)
REAL(KIND=JPRB),POINTER:: D1STSRO(:)
REAL(KIND=JPRB),POINTER:: D1SMLT(:)
REAL(KIND=JPRB),POINTER:: D1SVTRC(:,:)
REAL(KIND=JPRB),POINTER:: D1SVTRA(:,:)
REAL(KIND=JPRB),POINTER:: D1T2M(:)
REAL(KIND=JPRB),POINTER:: D1D2M(:)

REAL(KIND=JPRB),POINTER:: D1SLAI(:)
REAL(KIND=JPRB),POINTER:: D1SBIOM(:)
REAL(KIND=JPRB),POINTER:: D1SBLOSS(:)
REAL(KIND=JPRB),POINTER:: D1SBGAIN(:)
REAL(KIND=JPRB),POINTER:: D1SBIOMSTR(:)
REAL(KIND=JPRB),POINTER:: D1SBIOMSTRB(:)
REAL(KIND=JPRB),POINTER:: D1SVTFR(:,:)
REAL(KIND=JPRB),POINTER:: D1SVTLAI(:,:)
REAL(KIND=JPRB),POINTER:: D1SVTBIOM(:,:)
REAL(KIND=JPRB),POINTER:: D1SVTBLOSS(:,:)
REAL(KIND=JPRB),POINTER:: D1SVTBGAIN(:,:)
REAL(KIND=JPRB),POINTER:: D1SVTBIOMSTR(:,:)
REAL(KIND=JPRB),POINTER:: D1SVTBIOMSTRB(:,:)
REAL(KIND=JPRB),POINTER:: D1SVTGC(:,:)
REAL(KIND=JPRB),POINTER:: D1SVTGA(:,:)
REAL(KIND=JPRB),POINTER:: D1SVTF2(:,:)
REAL(KIND=JPRB),POINTER:: D1SVTDS(:,:)
REAL(KIND=JPRB),POINTER:: D1SVTDMAX(:,:)
REAL(KIND=JPRB),POINTER:: D1SVTLE(:,:)



REAL(KIND=JPRB),POINTER:: D1STIFR2(:,:,:)
REAL(KIND=JPRB),POINTER:: D1STITK2(:,:,:)
REAL(KIND=JPRB),POINTER:: D1STISKC2(:,:,:)
REAL(KIND=JPRB),POINTER:: D1STISKC(:,:)

REAL(KIND=JPRB),POINTER:: D1STIALB2(:,:,:)

REAL(KIND=JPRB),POINTER:: D1SNFR2(:,:)
REAL(KIND=JPRB),POINTER:: D1SNTFR2(:,:)
REAL(KIND=JPRB),POINTER:: D1SNAFR2(:,:)

REAL(KIND=JPRB),POINTER:: D1SWFR2(:,:)

REAL(KIND=JPRB),POINTER:: D1SAVTK2(:,:)
REAL(KIND=JPRB),POINTER:: D1SRADTK2(:,:)
REAL(KIND=JPRB),POINTER:: D1SVEGTK2(:,:)
REAL(KIND=JPRB),POINTER:: D1SGHF2(:,:)
REAL(KIND=JPRB),POINTER:: D1SALB2(:,:)
REAL(KIND=JPRB),POINTER:: D1SVEGEV2(:,:)
REAL(KIND=JPRB),POINTER:: D1SDSH2(:,:)
REAL(KIND=JPRB),POINTER:: D1STNDH2(:,:)
REAL(KIND=JPRB),POINTER:: D1SSDS2(:,:)
REAL(KIND=JPRB),POINTER:: D1SSDSSL2(:,:,:)
REAL(KIND=JPRB),POINTER:: D1SWDSSL2(:,:,:)
REAL(KIND=JPRB),POINTER:: D1SWDS2(:,:)
REAL(KIND=JPRB),POINTER:: D1SWLDS2(:,:)
REAL(KIND=JPRB),POINTER:: D1SLSRF2(:,:)
REAL(KIND=JPRB),POINTER:: D1SCRF2(:,:)
REAL(KIND=JPRB),POINTER:: D1SLSSF2(:,:)
REAL(KIND=JPRB),POINTER:: D1SCSF2(:,:)
REAL(KIND=JPRB),POINTER:: D1STE2(:,:)
REAL(KIND=JPRB),POINTER:: D1STRO2(:,:)
REAL(KIND=JPRB),POINTER:: D1STSRO2(:,:)
REAL(KIND=JPRB),POINTER:: D1SMLT2(:,:)
REAL(KIND=JPRB),POINTER:: D1SVTRC2(:,:,:)
REAL(KIND=JPRB),POINTER:: D1SVTRA2(:,:,:)
REAL(KIND=JPRB),POINTER:: D1T2M2(:,:)
REAL(KIND=JPRB),POINTER:: D1D2M2(:,:)

REAL(KIND=JPRB),POINTER:: D1SLAI2(:,:)
REAL(KIND=JPRB),POINTER:: D1SBIOM2(:,:)
REAL(KIND=JPRB),POINTER:: D1SBLOSS2(:,:)
REAL(KIND=JPRB),POINTER:: D1SBGAIN2(:,:)
REAL(KIND=JPRB),POINTER:: D1SBIOMSTR2(:,:)
REAL(KIND=JPRB),POINTER:: D1SBIOMSTRB2(:,:)
REAL(KIND=JPRB),POINTER:: D1SVTFR2(:,:,:)
REAL(KIND=JPRB),POINTER:: D1SVTLAI2(:,:,:)
REAL(KIND=JPRB),POINTER:: D1SVTBIOM2(:,:,:)
REAL(KIND=JPRB),POINTER:: D1SVTBLOSS2(:,:,:)
REAL(KIND=JPRB),POINTER:: D1SVTBGAIN2(:,:,:)
REAL(KIND=JPRB),POINTER:: D1SVTBIOMSTR2(:,:,:)
REAL(KIND=JPRB),POINTER:: D1SVTBIOMSTRB2(:,:,:)
REAL(KIND=JPRB),POINTER:: D1SVTGC2(:,:,:)
REAL(KIND=JPRB),POINTER:: D1SVTGA2(:,:,:)
REAL(KIND=JPRB),POINTER:: D1SVTF22(:,:,:)
REAL(KIND=JPRB),POINTER:: D1SVTDS2(:,:,:)
REAL(KIND=JPRB),POINTER:: D1SVTDMAX2(:,:,:)
REAL(KIND=JPRB),POINTER:: D1SVTLE2(:,:,:)

REAL(KIND=JPRB),POINTER:: D1SVWIND2(:,:)
REAL(KIND=JPRB),POINTER:: D1SUWIND2(:,:)
REAL(KIND=JPRB),POINTER:: D1SVWIND(:)
REAL(KIND=JPRB),POINTER:: D1SUWIND(:)
REAL(KIND=JPRB),POINTER:: D1SQAIR2(:,:)
REAL(KIND=JPRB),POINTER:: D1SCO2AIR2(:,:)
REAL(KIND=JPRB),POINTER:: D1STAIR2(:,:)
REAL(KIND=JPRB),POINTER:: D1SQAIR(:)
REAL(KIND=JPRB),POINTER:: D1SCO2AIR(:)
REAL(KIND=JPRB),POINTER:: D1STAIR(:)
REAL(KIND=JPRB),POINTER:: D1SPSURF(:)
REAL(KIND=JPRB),POINTER:: D1SPSURF2(:,:)

REAL(KIND=JPRB),POINTER:: D1SRECO2(:,:)
REAL(KIND=JPRB),POINTER:: D1SRSOIL_STR2(:,:)
REAL(KIND=JPRB),POINTER:: D1SRECO(:)
REAL(KIND=JPRB),POINTER:: D1SRSOIL_STR(:)

REAL(KIND=JPRB),POINTER:: D1SVTRECO2(:,:,:)
REAL(KIND=JPRB),POINTER:: D1SVTRSOIL_STR2(:,:,:)
REAL(KIND=JPRB),POINTER:: D1SVTRECO(:,:)
REAL(KIND=JPRB),POINTER:: D1SVTRSOIL_STR(:,:)


REAL(KIND=JPRB),POINTER:: D1WFLUXRF2(:,:)
REAL(KIND=JPRB),POINTER:: D1HFLUXRF2(:,:)
REAL(KIND=JPRB),POINTER:: D1WSN2(:,:)
REAL(KIND=JPRB),POINTER:: D1WFLUXRF(:)
REAL(KIND=JPRB),POINTER:: D1HFLUXRF(:)
REAL(KIND=JPRB),POINTER:: D1WSN(:)

!BVOC emissions diagnostics
REAL(KIND=JPRB),POINTER:: D1SBVOCST1(:,:)
REAL(KIND=JPRB),POINTER:: D1SBVOCST2(:,:)

REAL(KIND=JPRB),ALLOCATABLE :: DCMFCOM(:,:)

INTEGER(KIND=JPIM) :: N2DDI
INTEGER(KIND=JPIM) :: N2DDIAUX
END MODULE YOMGDI1S
